#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File   ：GetCSProduct_New -> product
@IDE    ：PyCharm
@Author ：Json
@Date   ：2021-03-31 10:58
@Desc   ：这里面api接口包括：
    1、cs类目 2021-5-18 增加
=================================================='''
import json

from cs_api.base import Client


class CategoryApi(Client):
    URI = "/new-categorytb/"

    def __init__(self, rcustomerno):
        super().__init__(rcustomerno)

    def get_all_category(self, location='HK', is_save=False):
        """
        location: HK or US
        :return:{
            code: 200
            msg: "success"
            result: [{categoryID: 11000, categoryNameEn: "Accessories",…}, {categoryID: 17000, categoryNameEn: "Audio",…},…]
        """
        data = {
            'lang': 'en_us',
            'region': location
        }
        return self.make_request("POST", "queryAllCategory", data, is_save=is_save)


if __name__ == '__main__':
    products = CategoryApi(2119)
    # products.test_request = True
    result = products.get_all_category()
    print(result.json())

    # result = products.get_product_image('CS-GRM600XL')
    # print(result.json())
